class CategoriesController < ApplicationController
  def index
    @page_title="Categories"
    @categories=Category.all.sorted
  end

  def show
    @category=Category.find(params[:id])
  end

  def new
    @category=Category.new
  end

  def edit

  end

  def update
    @category=Category.find(category_params)

  end

  def destroy
  end

  private
  def set_category
    @category = Category.find(params[:id])
  end

  def category_params
    params.require(:category).permit(:name, blog_ids:[])
  end
end
